package com.cg.design.depthdesign.builder.components;

import com.cg.design.depthdesign.builder.cars.Car;

/**
 * 产品特征 4：行车电脑
 * @program: LeetCode->TripComputer
 * @author: cg
 * @create: 2022-05-08 16:19
 **/
public class TripComputer {

    /**
     * 汽车产品
     */
    private Car car;

    public void setCar(Car car) {
        this.car = car;
    }

    /**
     * 显示油位
     */
    public void showFuelLevel() {
        System.out.println("Fuel level: " + car.getFuel());
    }

    /**
     * 显示汽车是否启动
     */
    public void showStatus() {
        if (this.car.getEngine().isStarted()) {
            System.out.println("Car is started");
        } else {
            System.out.println("Car isn't started");
        }
    }

}
